using System;
using System.Data;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using THSLib;
using THSERP.BaseProvider;
using THSERP.BusinessEntities;
namespace THSERP.Modules.TaxDec
{
    public class TaxDecEntities : ERPModuleEntities
    {
        #region Declare Constant
        public readonly static String strARTaxDeclarationsObjectName = THSUtil.GetTableNameFromBusinessObjectType(typeof(ARTaxDeclarationsInfo));

        public readonly static String strARTaxDeclarationItemsObjectName = THSUtil.GetTableNameFromBusinessObjectType(typeof(ARTaxDeclarationItemsInfo));
       
        public readonly static String strARInvoicesObjectName = THSUtil.GetTableNameFromBusinessObjectType(typeof(ARInvoicesInfo));
        #endregion

        #region Declare all entities variables
        private ARTaxDeclarationsInfo _aRTaxDeclarationsObject;
        private ARTaxDeclarationItemsInfo _aRTaxDeclarationItemsObject;

        public THSItemsEntityList<TaxDecItemsEntity> lstARTaxDeclarationItems;

        public THSList<ARDocumentPaymentDetailsInfo> lstARDocumentPaymentDetails;
        public THSList<ARInvoicesInfo> lstARInvoices;
        public THSList<ARTaxDeclarationsInfo> lstARTaxDeclarations;
        public THSList<BRPOSsInfo> lstBRPOSs;
        public THSList<BRPOSItemsInfo> lstBRPOSItems;
        public THSList<ARInvoiceItemsInfo> lstARInvoiceItems;
        public THSList<AROpenDocumentsInfo> lstAROpentDocuments;
        public THSList<ARDocumentPaymentsInfo> lstARDocumentPayments;
        #endregion

        #region Public Properties
        public ARTaxDeclarationsInfo ARTaxDeclarationsObject
        {
            get
            {
                return _aRTaxDeclarationsObject;
            }
            set
            {
                _aRTaxDeclarationsObject = value;
            }
        }
        public ARTaxDeclarationItemsInfo aRTaxDeclarationItemsObject
        {
            get
            {
                return _aRTaxDeclarationItemsObject;
            }
            set
            {
                _aRTaxDeclarationItemsObject = value;
            }
        }

        public THSItemsEntityList<TaxDecItemsEntity> ARTaxDeclarationItemsList
        {
            get
            {
                return lstARTaxDeclarationItems;
            }
            set
            {
                lstARTaxDeclarationItems = value;
            }
        }
       

        public THSList<ARInvoicesInfo> ARInvoicesList
        {
            get
            {
                return lstARInvoices;
            }
            set
            {
                lstARInvoices = value;
            }
        }
        public THSList<ARTaxDeclarationsInfo> ARTaxDeclarationsList
        {
            get
            {
                return lstARTaxDeclarations;
            }
            set
            {
                lstARTaxDeclarations = value;
            }
        }
        public THSList<BRPOSsInfo> BRPOSsList
        {
            get
            {
                return lstBRPOSs;
            }
            set
            {
                lstBRPOSs = value;
            }
        }
        public THSList<ARDocumentPaymentDetailsInfo> ARDocumentPaymentDetailsList
        {
            get
            {
                return lstARDocumentPaymentDetails;
            }
            set
            {
                lstARDocumentPaymentDetails = value;
            }
        }
        public THSList<ARInvoiceItemsInfo> ARInvoiceItemsList
        {
            get { return lstARInvoiceItems; }
            set { lstARInvoiceItems = value; }
        }
        public THSList<AROpenDocumentsInfo> AROpentDocumentsList
        {
            get { return lstAROpentDocuments; }
            set { lstAROpentDocuments = value; }
        }
        public THSList<ARDocumentPaymentsInfo> ARDocumentPaymentsList
        {
            get { return lstARDocumentPayments; }
            set { lstARDocumentPayments = value; }
        }
        public THSList<BRPOSItemsInfo> BRPOSItemsList
        {
            get { return lstBRPOSItems; }
            set { lstBRPOSItems = value; }
        }
        #endregion

        #region Constructor
        public TaxDecEntities()
            : base()
        {
            _aRTaxDeclarationsObject = new ARTaxDeclarationsInfo();

            _aRTaxDeclarationItemsObject = new ARTaxDeclarationItemsInfo();

            lstARTaxDeclarationItems = new THSItemsEntityList<TaxDecItemsEntity>();
            lstARTaxDeclarations = new THSList<ARTaxDeclarationsInfo>();
            lstARInvoices = new THSList<ARInvoicesInfo>();
            lstBRPOSs = new THSList<BRPOSsInfo>();
            lstARDocumentPaymentDetails = new THSList<ARDocumentPaymentDetailsInfo>();
          lstBRPOSItems  = new  THSList<BRPOSItemsInfo>() ;
       lstARInvoiceItems = new  THSList<ARInvoiceItemsInfo> ();
       lstAROpentDocuments = new  THSList<AROpenDocumentsInfo>() ;
       lstARDocumentPayments = new  THSList<ARDocumentPaymentsInfo>() ;
        }

        #endregion

        #region Init Main Object,Module Objects functions
        public override void InitMainObject()
        {

            MainObject = ARTaxDeclarationsObject;
        }

        public override void InitModuleObjects()
        {
            ModuleObjects.Add(strARTaxDeclarationItemsObjectName, aRTaxDeclarationItemsObject);
        }

        public override void InitModuleObjectList()
        {
            lstARTaxDeclarationItems = new THSItemsEntityList<TaxDecItemsEntity>();
            //lstARTaxDeclarationItems.InitTHSItemsEntityList(this, THSUtil.GetTableNameFromBusinessObjectType(typeof(ARTaxDeclarationItemsInfo)));
            lstARTaxDeclarationItems.InitTHSList(this, strARTaxDeclarationsObjectName, strARTaxDeclarationItemsObjectName);
            lstARTaxDeclarations = new THSList<ARTaxDeclarationsInfo>();
            lstARTaxDeclarations.InitTHSList(this, string.Empty, strARTaxDeclarationsObjectName);
            lstARInvoices = new THSList<ARInvoicesInfo>();
            lstARInvoices.InitTHSList(this, string.Empty, strARInvoicesObjectName);
            lstBRPOSs = new THSList<BRPOSsInfo>();
            lstBRPOSs.InitTHSList(this, string.Empty, "BRPOSs");
            lstARDocumentPaymentDetails.InitTHSList(this, String.Empty, THSUtil.GetTableNameFromBusinessObjectType(typeof(ARDocumentPaymentDetailsInfo)));
            lstBRPOSItems = new THSList<BRPOSItemsInfo>();
            lstBRPOSItems.InitTHSList(this, String.Empty, "BRPOSItems");
            lstARInvoiceItems = new THSList<ARInvoiceItemsInfo>();
            lstARInvoiceItems.InitTHSList(this, String.Empty, "ARInvoiceItems");
            lstAROpentDocuments = new THSList<AROpenDocumentsInfo>();
            lstAROpentDocuments.InitTHSList(this, String.Empty, "AROpenDocuments");
            lstARDocumentPayments = new THSList<ARDocumentPaymentsInfo>();
            lstARDocumentPayments.InitTHSList(this,String.Empty,"ARDocumentPayments");

        }

        public override void InitGridControlInTHSList()
        {
            lstARTaxDeclarationItems.InitTHSListGridControl();
            lstARTaxDeclarations.InitTHSListGridControl();
            lstARInvoices.InitTHSListGridControl("fld_dgvARInvoices");
            lstBRPOSs.InitTHSListGridControl();
        }

        public override void SetDefaultModuleObjectsList()
        {
            try
            {
                lstARTaxDeclarationItems.SetDefaultListAndRefreshGridControl();
                lstARTaxDeclarations.SetDefaultListAndRefreshGridControl();
                lstARInvoices.SetDefaultListAndRefreshGridControl();
                lstBRPOSs.SetDefaultListAndRefreshGridControl();

            }
            catch (Exception)
            {
                return;
            }
        }

        #endregion

        #region Invalidate Module Objects functions


        public override void InvalidateModuleObjects(int iObjectID)
        {
            ARTaxDeclarationItemsList.Invalidate(iObjectID);
        }


        #endregion

        #region Save Module Objects functions

        //public override void SaveModuleObjects()
        //{
        //    ARTaxDeclarationItemsList.SaveItemObjects(true);
        //}

     #endregion

        //public override void SetValuesAfterValidateProduct(int iARInvoiceID)
        //{
        //    ARTaxDeclarationItemsList.SetDefaultValuesFromProduct(iARInvoiceID);
        //}
    }
}
